<?php
	#Include the connect.php file
	include('connect.php');
	#Connect to the database
	//connection String
	$mysqli = new mysqli($hostname,$username,$password,$database);

	if ($result = $mysqli->query("SELECT * FROM wp_zzgraph")) {
    
	while($row = $result->fetch_assoc())
	{
		$orders[] = array(
			'period' => $row['CreateDateTime'],
			'licensed' => $row['Price'],
			'sorned' => $row['Percent']
		  );
	}
	//var_dump($orders);
	echo json_encode($orders);
	//$row = $result->fetch_assoc();
	//cho $row['Id'];
	
    /* free result set */
    $result->close();
	}

	
	// get data and store in a json array
	//while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	//	$orders[] = array(
	//		'OrderDate' => $row['OrderDate'],
	//		'ProductName' => $row['ProductName'],
	//		'Quantity' => $row['Quantity']
	//	  );
	//}
  
	//echo json_encode($orders);
?>